package com.SmartEdu.register;

import java.util.Random;

public class VerifyCodeGenerator {

    public static String generateVerificationCode() {
        // 定义验证码字符集
        String chars = "0123456789";
        StringBuilder code = new StringBuilder();
        Random random = new Random();
        int verifyCodeLength = 6;
        for (int i = 0; i < verifyCodeLength; i++) {
            // 随机选取字符集中的一个字符
            int index = random.nextInt(chars.length());
            code.append(chars.charAt(index));
        }

        return code.toString();
    }
}
